<div class="container-fluid mt-4">
    <!-- 头部标题 -->
    <div class="card mb-2">
        <!--Card content-->
        <div class="card-body">
            <h6 class="mb-2 mb-sm-0 pt-1" style="text-align: center;">老师管理</h6>
        </div>
    </div>
    <!-- 头部标题-end -->
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg">
            <div class="card mb-2">
                <!--Card content-->
                <div class="card-body">
                    <form id="tfs">
                        <div class="form-row align-items-center mb-3">
                            <div class="col-auto">
                                <div class="input-group input-group-sm">
                                    <input type="text" class="form-control" name="tname" placeholder="老师名称">
                                    <div class="input-group-append">
                                        <button class="btn btn-outline-secondary" type="button" onclick="seachteacher()">搜索</button>
                                    </div>
                                </div>
                            </div>
                            <div class="col-auto">
                                <button type="button" class="btn btn-success btn-sm" data-toggle="modal"
                                    data-target="#addTeacher">添加新老师</button>
                            </div>
                        </div>
                    </form>
                    <table class="table table-striped table-bordered table-align">
                        <thead class="thead-dark">
                            <tr>
                                <th scope="col">老师编号</th>
                                <th scope="col">老师名称</th>
                                <th scope="col">登录账号</th>
                                <th scope="col">账号权限</th>
                                <th scope="col">账号状态</th>
                                <th scope="col">操作</th>
                            </tr>
                        </thead>
                        <tbody id="t">
                            <!-- <tr>
                                <th>1</th>
                                <td>王二</td>
                                <td>wanger</td>
                                <td>超级管理员</td>
                                <td class="text-success">启用</td>
                                <td>
                                    <button type="button" class="btn btn-danger btn-sm">禁用</button>
                                    <button type="button" class="btn btn-warning btn-sm">密码重置</button>
                                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal"
                                        data-target="#settingTeacher">更新</button>
                                </td>
                            </tr>
                            <tr>
                                <th>2</th>
                                <td>张三</td>
                                <td>zhangsan</td>
                                <td>管理员</td>
                                <td class="text-danger">禁用</td>
                                <td>
                                    <button type="button" class="btn btn-info btn-sm">启用</button>
                                    <button type="button" class="btn btn-warning btn-sm">密码重置</button>
                                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal"
                                        data-target="#settingTeacher">更新</button>
                                </td>
                            </tr>
                            <tr>
                                <th>2</th>
                                <td>张三</td>
                                <td>zhangsan</td>
                                <td>老师</td>
                                <td class="text-danger">禁用</td>
                                <td>
                                    <button type="button" class="btn btn-info btn-sm">启用</button>
                                    <button type="button" class="btn btn-warning btn-sm">密码重置</button>
                                    <button type="button" class="btn btn-primary btn-sm" data-toggle="modal"
                                        data-target="#settingTeacher">更新</button>
                                </td>
                            </tr> -->
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script id="demo" type="text/html">
     {{each result v}}
     <tr>
        <th>{{v.teacherId}}</th>
        <td>{{v.teacherName}}</td>
        <td>{{v.username}}</td>
        <td>{{v.rolename}}</td>
        {{if v.status==1}}
        <td class="text-success">启用</td>
        {{else}}
        <td class="text-danger">禁用</td>
        {{/if}}

        <td>
            {{if v.status!=1}}
            <button type="button" value="{{v.teacherId}}" class="btn btn-info btn-sm" onclick="start(this)">启用</button>
            {{else}}
            <button type="button" value="{{v.teacherId}}" class="btn btn-danger btn-sm" onclick="stop(this)">禁用</button>
            {{/if}}
            <button type="button" value="{{v.teacherId}}" class="btn btn-warning btn-sm" onclick=" password(this)">密码重置</button>
            <button type="button" value="{{v.teacherId}}" class="btn btn-primary btn-sm" data-toggle="modal"
                data-target="#settingTeacher" onclick="reTeacher(this)">更新</button>
        </td>
    </tr>
     {{/each}}
</script>

<script id="demo_" type="text/html">
    <tr>
        <th>{{data.teacherId}}</th>
        <td>{{data.teacherName}}</td>
        <td>{{data.username}}</td>
        <td>{{data.rolename}}</td>
        {{if data.status==1}}
        <td class="text-success">启用</td>
        {{else}}
        <td class="text-danger">禁用</td>
        {{/if}}

        <td>
            {{if data.status!=1}}
            <button type="button" value="{{data.teacherId}}" class="btn btn-info btn-sm" onclick="start(this)">启用</button>
            {{else}}
            <button type="button" value="{{data.teacherId}}" class="btn btn-danger btn-sm" onclick="stop(this)">禁用</button>
            {{/if}}
            <button type="button" value="{{data.teacherId}}" class="btn btn-warning btn-sm" onclick=" password(this)">密码重置</button>
            <button type="button" value="{{data.teacherId}}" class="btn btn-primary btn-sm" data-toggle="modal"
                data-target="#settingTeacher" onclick="reTeacher(this)">更新</button>
        </td>
    </tr>
</script>

<!-- 课程添加 -->
<div class="modal fade" id="addTeacher" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">老师添加</h5>
                <button type="button" class="close" data-dismiss="modal">
                    <span>×</span>
                </button>
            </div>
            <div class="modal-body">
                <form id="">
                    <div class="form-group">
                        <label for="teachername">老师名称</label>
                        <input type="text" class="form-control" id="teachername">
                    </div>
                    <div class="form-group">
                        <label for="username">登录账号</label>
                        <input type="text" class="form-control" id="username">
                    </div>
                    <div class="form-group">
                        <label for="role">角色选择</label>
                        <select class="form-control" id="role" name="role">
                            <option>请选择角色</option>
                            <option>管理员</option>
                            <option>老师</option>
                        </select>
                    </div>
                </form>
                <!-- -->
                <script id="demo2" type="text/html">
                    <option value="null">请选择角色</option>
                    {{each result r}}
                    <option value="{{r.roleId}}">{{r.roleName}}</option>
                    {{/each}}
                </script>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary">添加</button>
            </div>
        </div>
    </div>
</div>
<!-- 课程添加-结束 -->
<!-- 课程修改 -->
<div class="modal fade" id="settingTeacher" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">老师信息修改</h5>
                <button type="button" class="close" data-dismiss="modal">
                    <span>×</span>
                </button>
            </div>
            <div class="modal-body">
                <form id="tef">
                    <div class="form-group">
                        <label for="teacherno1">老师编号</label>
                        <input type="text" class="form-control" value="1" id="teacherno1" name="teacherid" readonly>
                    </div>
                    <div class="form-group">
                        <label for="teachername1">老师名称</label>
                        <input type="text" class="form-control" value="王二" id="teachername1">
                    </div>
                    <div class="form-group">
                        <label for="username1">登录账号</label>
                        <input type="text" class="form-control" value="wanger" id="username1">
                    </div>
                    <div class="form-group">
                        <label for="role">角色选择</label>
                        <select class="form-control" id="role" name="">
                            <option>请选择角色</option>
                            <option>管理员</option>
                            <option>老师</option>
                        </select>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="updatedTeach()">更新</button>
            </div>
        </div>
    </div>
</div>
<!-- 课程修改-结束 -->
<script>

</script>

<script src="./js/teacherPage.js"></script>
<script src="./js/template-web.js"></script>